//
//  YKMarcros.h
//  YingKe
//
//  Created by 崔博 on 16/11/19.
//  Copyright © 2016年 崔博. All rights reserved.
//

#ifndef YKMarcros_h
#define YKMarcros_h

#ifdef DEBUG // 判断开发调试状态
#define BBLog(...) NSLog(__VA_ARGS__)
#elif
#define BBLog(...)
#endif


#endif /* YKMarcros_h */
// 注册cell
#define REGISCLASSCELL(view,cell,ide) [view registerClass:[cell class] forCellReuseIdentifier:ide];
#define REGISNIBCELL(view,cell,ide) [view registerNib:[UINib nibWithNibName:cell bundle:nil] forCellReuseIdentifier:ide];
// 屏幕宽高
#define SCREEN_WIDTH   [UIScreen mainScreen].bounds.size.width
#define SCREENH_HEIGHT [UIScreen mainScreen].bounds.size.height
// 获取主窗口
#define WINDOW [UIApplication sharedApplication].keyWindow

// 颜色
// 获取RGB颜色
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)
// 背景色
#define BACKGROUND_COLOR [UIColor colorWithRed:242.0/255.0 green:242.0/255.0 blue:242.0/255.0 alpha:1.0]

// 约束
#define MASONRY(dir,layout,of) make.dir.equalTo(layout).offset(of)
#define MASONRYINSERT(view,t,l,b,r) make.edges.equalTo(view).with.insets(UIEdgeInsetsMake(t, l, b, r));

// 宏定义
// .h文件
#define SingletonH(name) + (instancetype)share##name;
// .m文件
#define SingletonM(name) \
static id _instance = nil; \
+ (id)allocWithZone:(struct _NSZone *)zone \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instance = [super allocWithZone:zone]; \
}); \
return _instance; \
} \
+ (instancetype)share##name \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instance = [[self alloc] init]; \
}); \
return _instance; \
} \
- (id)copyWithZone:(NSZone *)zone \
{ \
return _instance; \
}
